/****************************************************************************

	COPYRIGHT(C) MAXSI SOFTWARE, JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010

    This file is part of Maxsi Installer.

    Maxsi Installer is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Maxsi Installer is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Maxsi Installer.  If not, see <http://www.gnu.org/licenses/>.

	*/ #include "MaxsiInstallerContributors.h" /*

	If you modify this file, please enter your name below and provide contact
	information in MaxsiEngineContributors.h. For more information please see
	MaxsiEngineContributors.h.
	
	Contributors to this file:

	- Jonas 'Sortie' Termansen
	- [your name here]

	MaxsiInstaller.exe
	The main installing technology utilized in the powerful Maxsi Distribution
	platform.

	UI.h
	The User Interface for MaxsiInstaller

****************************************************************************/

#ifndef UI_H
#define UI_H


#define MSG_Next			100
#define MSG_Previous		101
#define MSG_Cancel			102
#define MSG_Finish			103
#define MSG_SetStatus		104
#define	MSG_SetProgress		105
#define	MSG_RecieveError	106
#define	MSG_RecieveNews		107
#define GotoFailurePage		200
#define GotoSuccessPage		201
#define GotoConnectionPage	202
#define GotoErrorPage		203
#define GotoPasswordPage	204
#define QuitMessage			300


#define ME_RedrawControl(Control,Window,X,Y,W,H) 	\
	MoveWindow(Control,X,Y,W,H,FALSE); \
	ValidateRect(Window,&(MKRect(X,Y,W,H))); \
	RedrawWindow(Control,NULL,NULL, RDW_INVALIDATE | RDW_NOINTERNALPAINT | RDW_ERASE);

class MaxsiInstallerPage : public MaxsiUI_Form
{
	Declare_Class(MaxsiInstallerPage,MaxsiUI_Form);

public:

	MaxsiInstallerPage();

	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Header;
	char*	HeaderTextOverride;

};

class PageWelcome : public MaxsiInstallerPage
{
	Declare_Class(PageWelcome,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Previous;
	HWND	Next;


};

class PageAgreementMaxsiDistributionNotice : public MaxsiInstallerPage
{
	Declare_Class(PageAgreementMaxsiDistributionNotice,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Previous;
	HWND	Next;

};



class PageAgreementMaxsiDistribution : public MaxsiInstallerPage
{
	Declare_Class(PageAgreementMaxsiDistribution,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Previous;
	HWND	Next;
	HWND	License;

};


class PageAgreementProduct : public MaxsiInstallerPage
{
	Declare_Class(PageAgreementProduct,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Previous;
	HWND	Next;
	HWND	License;

};

class PageWhereToInstall : public MaxsiInstallerPage
{
	Declare_Class(PageWhereToInstall,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Previous;
	HWND	Next;
	HWND	SteamPath;

};

class PageSteamUsername : public MaxsiInstallerPage
{
	Declare_Class(PageSteamUsername,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Previous;
	HWND	Next;
	HWND	SteamPath;
	HWND*	ControlList;
	List	SteamUserNameList;
	HWND	SteamUserNameText;

	unsigned int NumNames;
};

class PageRevise : public MaxsiInstallerPage
{
	Declare_Class(PageRevise,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Previous;
	HWND	Next;


};


class PageInitialize : public MaxsiInstallerPage
{
	Declare_Class(PageInitialize,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool Connect();
	virtual bool RequestParameters();
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);
	virtual bool SetProgress(int Progress);

public:
	HWND ProgressBar;
	HWND ProductNameField;
	HWND ProductNameLabel;
	HWND MasterServerField;
	HWND MasterServerLabel;
	HWND StatusLabel;
	HWND SubStatusLabel;
	HWND cmdRetry;
	bool NeedInput;
};



class PageInstaller : public MaxsiInstallerPage
{
	Declare_Class(PageInstaller,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);
	virtual bool SetProgress(int Progress);

public:
	HWND ProgressBar;
	HWND StatusLabel;
	HWND SubStatusLabel;
	HWND cmdStats;
	HWND cmdNews;
	HWND cmdError;
	HWND txtNews;
	HWND txtError;
};



class PageSuccess : public MaxsiInstallerPage
{
	Declare_Class(PageSuccess,MaxsiInstallerPage);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

public:
	HWND	Text;
	HWND	Next;

};

RECT		MKRect							(LONG Left, LONG Top, LONG Right, LONG Bottom);
char*		DetectSteamFolder				(void);
List		DetectSteamUsername				( unsigned int* NameCount, size_t* RecommendedUser );
size_t		DetectNumGamesInstallForUser	( char* Username );

#endif